#include <Arduino.h>
#include <Servo.h>

Servo myServo1;
Servo myServo2;
int led_pin = 13;
int pinRX = 0;
int pinTx = 1;
String value = "";

void setup() {
    //设置舵机引脚
    myServo1.attach(3);
    myServo2.attach(2);
    //初始化串口
    Serial.begin(9600);
    pinMode(led_pin,OUTPUT);
}

void loop() {
    //测试 串口||蓝牙通信
    while(Serial.available()>0){
        value += char(Serial.read());
        Serial.println("**");
        Serial.println(value);
        delay(2);
    }
    if(value == "Start"){
        digitalWrite(led_pin,HIGH);
        digitalWrite(led_pin,LOW);
        myServo1.write(180);
        delay(1000);
        myServo2.write(180);
        delay(1000);
        Serial.println("Bluetooth Start");
        value = "";
    } else if (value == "End"){
        myServo1.write(0);
        delay(1000);
        myServo2.write(0);
        delay(1000);
        Serial.write("Bluetooth End");
        value = "";
    }
}